/**
* @author maze | guavestudios.com
* @license MIT License see LICENSE.TXT
* @version 0.1
*/
package com.guavestudios.fcon.core {

	/**
	* A node of a path
	* TODO: Refactor
	*/
	public class PathElement {
		
		//{ STATIC
	
		//}
		
		//{ MEMBERS
		private var parent:PathElement;
		private var element:Object;
		private var elementId:String;
		//}
		
		//{ GETTER-SETTER
	/**
	* TODO Insert description from GET elementId here.
	*  
	*  @return String
	*/
	public function getElementId():String {
		return this.elementId;
	}
	/**
	* TODO Insert description from SET elementId here.
	*  
	*  @param pelementId[String]
	*  @return
	*/
	public function setElementId(pelementId:String):void {
		this.elementId = pelementId;
	}
	/**
	* TODO Insert description from GET element here.
	*  
	*  @return Object
	*/
	public function getElement():Object {
		if (typeof element=="function")
		{
			return element();
		}
		return this.element;
	}
	/**
	* TODO Insert description from SET element here.
	*  
	*  @param pelement[Object]
	*  @return
	*/
	public function setElement(pelement:Object):void {
		this.element = pelement;
	}
	/**
	* TODO Insert description from GET parent here.
	*  
	*  @return PathElement
	*/
	public function getParent():PathElement {
		return this.parent;
	}
	/**
	* TODO Insert description from SET parent here.
	*  
	*  @param pparent[PathElement]
	*  @return
	*/
	public function setParent(pparent:PathElement):void {
		this.parent = pparent;
	}
		
		//}
		public function PathElement() {
			
			
			init();	
		}
		private function init():void {
			
		}
		//{ PUBLIC FUNCTIONS
		public function getAttribute(attr:String):Object
		{
			return element[attr];
		}
		public function getPath():String
		{
			if (parent) return parent.getPath()+"."+getElementId();
			else return getElementId();
		}
		public function toString():String
		{
			return element.toString();
		}
		public function dispose():void
		{
			element=null;
			parent=null;
		}
		//}
		
		//{ OVERRIDEN METHODS
		
		//}
		
		//{ PRIVATE FUNCTIONS
		
		//}

	}
	
}
